import { useEffect } from "react";
import "./ResizeObserverTest.scss";

export function ResizeObserverTest() {
  useEffect(() => {
    const box = document.querySelector("#box");

    setTimeout(() => {
      box.style.width = "200px";
    }, 3000);

    const resizeObserver = new ResizeObserver((entries) => {
      console.log("当前大小", entries);
    });
    resizeObserver.observe(box);

    return () => {};
  }, []);
  return (
    <>
      <div id="box">
        <button>光</button>
      </div>
    </>
  );
}
